Tomohiro Abe

TeX Memo

references

Shade

    \usepackage{shaded}
    \definecolor{shadecolor}{gray}{0.90}
    
    \begin{shaded}
    ほげほげ
    \end{shaded}
  
とすると、「ほげほげ」のところが灰色で塗りつぶされた四角で囲まれる。今まさに TeX のコマンドが黒で塗りつぶされた四角で囲まれているように。定理を書いたり、レフリーレポートへの返信でレフリーのコメントを引用するときに便利だと思われる。
shaded.sty は ここで入手可能。

YaTex

citation list

引用文献の作成は、inSPIREのツール を使うと楽。
等とアーカイブ番号を打ち、アップロードすれば、 \begin{thebibliography}{99} 以下に書くべきフォーマットを返してくれる。論文で引用する順番に並べてくれるので便利。

古いものは arXiv 番号がないので、論文番号を入れるのが楽だと思う。やり方は、

どうしようもなかったら、inSPIREでLaTeX(US) をクリックしてでてくる、

等をそのまま使う。

some commands

style files

refTeX/bibTeX

latexmk

pdflatex のとき latexmk -gg -pdf filename.tex

latexdiff

latexdiff old.tex new.tex > diff.tex

url

本文中に url を貼りたい時がある。そのまま http:// ... などと書くと怒られるので、
    \usepackage{url}
    \url{http://aaa.html}  
とする。勝手にリンクも貼られる。\url のカッコ内に余計な空白は入れないこと。入れるとクリックしてもエラーが出て飛ばない。

pdf in figure

mediabb.sty を ここから ダウンロード。
あとは、
\usepackage{mediabb}
を使えばよい。

ただし、arXivに投稿するときは、pdfLatexを使うので、
%\usepackage{mediabb}
と、コメントアウトせよ。

eps を変換してつくった pdf は余白ができる場合がある。その場合はターミナルで "pdfcrop aaa.pdf"

arXiv

arXivは pdfLatexを使っているらしいので、以下のことに注意。

余白の設定

  • geometry をつかう。
  • geometryは divpdfm を使うらしいので、書いておく。他のところでは dvipdfmx と書いておく。
  • (図を挿入しないなら書かなくていい。) <例>
    \usepackage[dvipdfm, top=30truemm, bottom=25truemm, left=32truemm, right=32truemm, includehead, includefoot]{geometry}
    
    フッターを使わないなら、"includefoot"を消したほうがよい。余分な余白が作られないので。

    左右の余白に関して。A4に実際に印刷してみると、
    32mm は文字が少なく感じる。机に置いて見るとそうでもないが、手にもって見るとそう感じる。
    31mm もまだ微妙。
    30mm にすると、ちょうど良く感じる。
    2mmの違いは、11ptの日本語で、2文字。

    ヘッダーやフッターの設定

    fanchhdr をつかう。
    <コマンド例>
    \usepackage{fancyhdr}   
     \pagestyle{fancy}
     \lhead[\name]{\name}	%左側ヘッダの定義
     \chead{ほげほげ} %	中央ヘッダの定義
     \rhead[\thepage]{ほげほげ}	%右側ヘッダの定義
     \lfoot[偶数ページ]{奇数ページ}	%左側フッターの定義
     \cfoot[]{}	%中央フッターの定義
     \rfoot[偶数ページ]{奇数ページ}
     \renewcommand{\headrulewidth}{0pt} %ヘッダの線の太さ 
    %    線の横幅は文章幅(\textwidth)です。
    % http://keizai.xrea.jp/latex/tutorial/header.html
    
    <実例>
    やりたいこと
  • 左上に名前、
  • 右上に見出しとページ番号(現在のページ/全ページ数)
  • 下中央にページ番号を表示させない
  • ヘッダの下に線を引かない
    %%----------------------------------------------------------------------
    \usepackage{fancyhdr}   
     \pagestyle{fancy}
     \lhead[\name]{\name}	%左側ヘッダの定義
     \rhead[\thepage]{\midashi \ \thepage /\pageref{lastpage}}	%右側ヘッダの定義
     \cfoot[]{}	%中央フッターの定義
     \renewcommand{\headrulewidth}{0pt} %ヘッダの線の太さ 
    %    線の横幅は文章幅(\textwidth)です。
    % http://keizai.xrea.jp/latex/tutorial/header.html
    %----------------------------------------------------------------------
    \def\name{{阿部智広}} % define my name as \name
    \def\midashi{{これまでの研究概要}} % define right head as \midashi
    
    ...
    
    
    \label{lastpage}
    \end{document}
    

    日本語で書類

    公募書類など。送付状などの数式を使わない場合には、Word や Pages の方が楽。
    \documentclass[11pt]{jsarticle}
    \usepackage[dvipdfm, top=30truemm, bottom=25truemm, left=30truemm, right=30truemm, includehead, includefoot]{geometry}
    
  • jsarticle をつかうと、見やすい。(articleだと英語の環境なので、段落の字下げが1文字分ににならない。)
  • しかし、余白が気に入らないので geometry で設定。見やすくなるように調整したはず。wordのデフォルトの余白とほとんど一致するはず。

    備忘録

    %\RequirePackage{lineno}% revtex4 users need this command BEFORE
    		       % \documentclass if you wanna use
    		       % \linenumbers. Do not put \usepackage{linone}.
    % ----------------------------------------------------------------------
    %
    \documentclass[
    superscriptaddress % what's this?
    %,prd              % PRD format
    ,preprintnumbers   % to use \preprint{}
    ,amsmath           % no need to explain
    ,amssymb           % to use \lesssim, \gtrsim, (<~, >~)
    ,nofootinbib       % otherwise footnote appear in the last pages.
    ,dvipdfmx          % デフォルトのドライバをdvipdfmx にする。
    ,eqsecnum          % Number equations by section. (my preferance)
    ,a4paper           % default is letterpaper.
    ,secnumarabic      % Use 1,2,3, not I, II, III, in section name
    ,11pt             % Three options: 10pt(default), 11pt, 12pt
    %,preprint         % I do not like this. This is 12pt.
    ]{revtex4}         
    \usepackage{graphicx}        % [dvipdfxm] は上で指定しているので省略している。
    \usepackage[dvipdfmx]{color} % [dvipdfxm] は上で指定しているので省略可能。
    \usepackage{dcolumn}      % 小数点の位置で桁をそろえる.
    \usepackage{slashed}      % Dirac slahs, \slashed{p}
    \usepackage{bm,bbm}       % to use some fonts (ベクトルを太字で書きたいとき等)
    \usepackage{latexsym}     % to use old math characters.
    \usepackage{here}         % to use figure[H]
    %\usepackage{ascmac}	  % to use `\itembox' (yatex added)
    \usepackage{mathrsfs}     % 花文字
    \usepackage{multirow}     % やや複雑な表を作るとき
    %\usepackage{lineno}       % 行を表示する. Use RequirePackage{lineno}
    \usepackage{mediabb}     % to use xxx.pdf for including plots without
                              % bb files. we can generate bb files by ebb command.
    %\usepackage{jheppub}      % ここより下だと、hyperrefと相性が悪いと怒られる。
    \usepackage{hyperref}     % to make links in equations or refferences.
    \usepackage{subfigure}    % 図の中で、(a) (b) (c) とつけたいとき。
    \usepackage{titlesec}     % To use \newcommand*{\justifyheading}{\raggedleft}
    \usepackage{ulem}         % To use \sout{hoge} (上から線を引く)
    %----------------------------------------------------------------------
    %----------------------------------------------------------------------
    % too old to use
    %----------------------------------------------------------------------
    %\usepackage[dvips]{color}  % too old to use...
    %\usepackage{cancel}       % to use \cancle{p} etc.
    %----------------------------------------------------------------------
    %----------------------------------------------------------------------
    \pagestyle{plain}
    
    \newcommand{\tr}{\mbox{tr}}
    \newcommand{\VEV}[1]{\langle #1 \rangle}
    
    \newcommand{\ii}{\mathbbm{i}}
    \newcommand{\1}{\mbox{1}\hspace{-0.25em}\mbox{l}} % identity matrix
    \newcommand{\fb}{fb$^{-1}$}
    \newcommand{\pb}{pb$^{-1}$}
    \newcommand{\pt}{$p_{\mathrm{T}}$}
    \newcommand{\pz}{$p_{Z}$}
    \newcommand{\pznu}{$p_{Z}^{\nu}$}
    \newcommand{\MET}{$E_{\mathrm{T}}^{\mathrm{miss}}$}
    \newcommand{\mycomment}[1]{\textcolor{blue}{\textbf{#1}}}
    %-----------------------------------------------------------------------------
    % \slashchar puts a slash through a character to represent contraction
    % with Dirac matrices. Use \not instead for negation of relations, and use
    % \hbar for hbar.
    %-----------------------------------------------------------------------------
    \def\slashchar#1{\setbox0=\hbox{$#1$} % set a box for #1
    \dimen0=\wd0 % and get its size
    \setbox1=\hbox{/} \dimen1=\wd1 % get size of /
    \ifdim\dimen0>\dimen1 % #1 is bigger
    \rlap{\hbox to \dimen0{\hfil/\hfil}} % so center / in box
    #1 % and print #1
    \else % / is bigger
    \rlap{\hbox to \dimen1{\hfil$#1$\hfil}} % so center #1
    / % and print /
    \fi}
    
    
    %-----------------------------------------------------------------------------
    % When we use \linenumber, we need this makeatletter. If we do not use
    % this makeatlettr, line numbers are not printed near equations. This is
    % because lineno.sty are not familiar with \begin{aling}~\end{aling}.
    %-----------------------------------------------------------------------------
    \makeatletter
    % Make a copy of macros responsible for entering display math mode
    \let\start@align@nopar\start@align
    \let\start@gather@nopar\start@gather
    \let\start@multline@nopar\start@multline
    % Add the "empty line" command to the macros
    \long\def\start@align{\par\start@align@nopar}
    \long\def\start@gather{\par\start@gather@nopar}
    \long\def\start@multline{\par\start@multline@nopar}
    \makeatother
    
    
    
    
    %-----------------------------------------------------------------------------
    % Change the format of sections in revtex
    %-----------------------------------------------------------------------------
    % Section names are centering in revtex. I do not like it. I want to
    % make them flushleft. I found the following command achieves my wish. 
    %
    % In addition, \section{hogehoge} becomes HOGEHOGE in pdf file. I do not
    % like this neither. The following section also change this format.
    %
    % Comment out the followings when you submit to journal.
    %-----------------------------------------------------------------------------
    %
    %\newcommand*{\justifyheading}{\raggedleft}
    \newcommand*{\justifyheading}{\raggedright}
    \titleformat{\chapter}[display]
      {\normalfont\huge\bfseries\justifyheading}{\chaptertitlename\ \thechapter}
      {20pt}{\Huge}
    \titleformat{\section}
      {\normalfont\Large\bfseries\justifyheading}{\thesection}{1em}{}
    \titleformat{\subsection}
      {\normalfont\large\bfseries\justifyheading}{\thesubsection}{1em}{}
    \titleformat{\subsubsection}
      {\normalfont\bfseries\justifyheading}{\thesubsubsection}{1em}{}
    \usepackage[english]{babel}
    
    
    
    %-----------------------------------------------------------------------------
    % End of makeat letter
    %-----------------------------------------------------------------------------
    
    
    %\usepackage{amsmath}	% required for `\align' (yatex added)
    \begin{document}
    %\setpagewiselinenumbers
    %\modulolinenumbers[5]
    
    %\linenumbers % to show the line numbers (need \RequirePackage{lineno})
    
    %----------------------------------------------------------------------
    % Title
    %----------------------------------------------------------------------
    \preprint{}
    \preprint{}
    
    \title{Unitarity Sum Rules}
    
    \author{Tomohiro Abe}
    \affiliation{Place}
    
    \date{\today}
    %\date{June 13, 2012 \\ \ \  revised:\today}
    
    \begin{abstract}
    \end{abstract}
    
     
    \maketitle
    
    %----------------------------------------------------------------------
    % Body
    %----------------------------------------------------------------------
    
    \end{document}